import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler


def get_data():
    #获取数据
    data = pd.read_csv('../data/train.csv')
    #归一化
    X = data.drop(['label'], axis=1)
    y = data['label']
    X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=42)
    #特征工程
    scaler = MinMaxScaler()
    X_train = scaler.fit_transform(X_train)
    X_test = scaler.transform(X_test)
    # 将数据全部转化成ndarray
    y_train= y_train.values
    y_test = y_test.values
    return X_train, X_test, y_train, y_test